package com.tuanbiao.models.action;

import androidx.annotation.NonNull;

import com.hzjq.data.callback.HttpCallback;
import com.hzjq.data.callback.ProgressHttpCallback;
import com.hzjq.data.hzjq.entity.AppDataEntity;
import com.hzjq.lib.BlastKool;
import com.tuanbiao.data.callback.OnBaseResultCallback;

import java.io.File;

/**
 * @author abiao
 * @since 2022/5/6 11:03
 */
public interface HttpAction {
    default void downLoadApk(AppDataEntity appInfo, ProgressHttpCallback<File> httpCallback) {
        BlastKool.Companion.loader().http().downLoadApk(appInfo, true, false, httpCallback);
    }

    default void loadApp(boolean showLoading, OnBaseResultCallback<AppDataEntity> callback) {
        BlastKool.Companion.loader().http().loadApp(showLoading, new HttpCallback<AppDataEntity>() {
            @Override
            public void onSuccess(AppDataEntity appDataEntity) {
                callback.onSuccess(appDataEntity);
                callback.onFinish();
            }

            @Override
            public void onFailed(@NonNull String s) {
                callback.onFailed(s);
                callback.onFinish();
            }
        });
    }

}
